#ifndef LCD_H_
#define LCD_H_

#include <htc.h>
#include <stdio.h>
#include "delay.h"

#define	LCD_RS		RA4		// Register select
#define	LCD_EN		RA5		// Enable
#define	LCD_D4		RC4		// LCD data 4
#define	LCD_D5		RC5		// LCD data 5
#define	LCD_D6		RC6		// LCD data 6
#define	LCD_D7		RC7		// LCD data 7

#define LCD_ROWS	2	// valid numbers are: 1,2 
				// (set to 2 for 2 or more rows)
#define LCD_COLS	20	// valid numbers are: 8,16,20	

#define LCD_CLR			0x01 // Clear Display
#define LCD_HOME		0x02 // Cursor to Home position

/************************************************************************/
#if (LCD_COLS==20)
	#define LCD_line1	0x80 // Line 1 position 1
	#define LCD_line2	0xC0 // Line 2 position 1
	#define LCD_line3	0x94 // Line 3 position 1 (20 char LCD)
	#define LCD_line4	0xD4 // Line 4 position 1 (20 char LCD)
#else
	#define LCD_line1	0x80 // Line 1 position 1
	#define LCD_line2	0xC0 // Line 2 position 1
	#define LCD_line3	0x90 // Line 3 position 1 (16 char LCD)
	#define LCD_line4	0xD0 // Line 4 position 1 (16 char LCD)
#endif

void LCD_STROBE (void);
void LCD_NIBBLE_OUT (unsigned char c );
void LCD_WRITE (unsigned char c);
void LCD_CMD (char c);
void LCD_GOTO (char line,char pos);
void LCD_CLEAR (void);
void LCD_PUTCH (char c);
//void LCD_PUTUN (unsigned int c);
//void LCD_PUTSN (signed int c);
void LCD_PUTS (const char * s);
void LCD_INIT (void);


#endif /*LCD_H_*/
